﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace AI_Bots
{
    class Botao : Objeto
    {
        public Boolean pressionado;

        /// <summary>
        /// Função pra checar se o mouse está clicado
        /// </summary>
        /// <param name="mouse_atual"></param>
        /// <returns></returns>
        public bool isClicking(MouseState mouse_atual, MouseState mouse_anterior)
        {
            if ((mouse_atual.LeftButton == ButtonState.Pressed) && !(mouse_anterior.LeftButton == ButtonState.Pressed))
            {
                if (colisao.Contains(mouse_atual.X, mouse_atual.Y))
                    return true;
            }
            return false;
        }

        public Botao(Texture2D image, GameWindow Window, float X, float Y)
            : base(image, Window)
        {
            this.posicao.X = X;
            this.posicao.Y = Y;
            colisao = new Rectangle((int)X, (int)Y, imagem.Width, imagem.Height);
            pressionado = false;
        }

        override public void Update(GameTime gameTime) { }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(imagem, posicao, Color.White);
        }

    }
}